
<template>
    <implant-menu v-if="id" :pageInfo="menuInfo" :menuData="menuData" @menuCheck="menuCheck"></implant-menu>
</template>

<script>
import ImplantMenu from "@/components/ImplantMenu.vue"
export default {
    name: "appDesign",
    components: {
        ImplantMenu
    },
    computed: {},
    data: () => {
        return {
            id:"",
            menuInfo: {
                pageName: "",
                imgSrc:"",
                icon:"iconyingyongjieru",
                isShowHelp: false
            },
            menuData: []
        }
    },
    created() {
        const loading = this.$loading({lock: true});
        const id = this.$route.query.id 
        this.id = id 
        this.api.getAppInfo({params: {appId :this.id} },{method: "get", customRequest: true})
        .then(res=>{
            this.$nextTick(()=>{
                loading.close();
            })
            const isOwner =  res.data.ownerId === this.$store.state.user.userInfo.id
            const isOwnerStr = isOwner?'&isOwner=1':''
            this.menuInfo.imgSrc = res.data.dcBizIcon || require('@/assets/images/default.png')
            this.menuInfo.pageName = res.data.name
            this.menuData =   [
                {
                    name: "基础数据",
                    iframeSrc: `/cap4/business.do?method=businessBaseData&isBaseApp=0&bizConfigId=${id}${isOwnerStr}`,
                    checked: false,
                
                }, { 
                    name: "表单设置",
                    iframeSrc: `/cap4/business.do?method=editBusiness&isBaseApp=0&bizConfigId=${id}${isOwnerStr}`,
                    checked: true,
                    
                }, {
                    name: "报表设置",
                    iframeSrc: `/report4Design.do?method=index&category=cap4biz&categoryId=${id}`,
                    checked: false,
                }, {
                    name: "门户设置",
                    iframeSrc: `/cap4/business.do?method=businessPortalSet&isBaseApp=0&bizConfigId=${id}${isOwnerStr}`,
                    checked: false,
                }, {
                    name: "菜单设置",
                    iframeSrc: `/cap4/business.do?method=newMenu&isBaseApp=0&bizConfigId=${id}${isOwnerStr}`,
                    checked: false,
                }, {
                    name: "权限设置",
                    iframeSrc: `/cap4/business.do?method=unifiedAuth&isBaseApp=0&bizConfigId=${id}${isOwnerStr}`,
                    checked: false,
                }, {
                    name: "管理设置",
                    iframeSrc: `/common/cap4/bizconfig/appManage/appManage.html?isBaseApp=0&bizConfigId=${id}${isOwnerStr}`,
                    checked: false,
                }
            ]
        })
    },
    methods: {
        menuCheck(menu) {
            this.menuData.forEach(item =>{
                item.checked = menu.name === item.name;
            })
        }
    }
}
</script>